/*
 *  pack.h
 *  xcode
 *
 *  Created by Emiel Goor,van on 25-01-08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

// packet handling and types

#ifndef PACKET_H
#define PACKET_H

#include "pci.h"

// packet type
struct _packet_t
{
	uint16_t len;
	uint8_t *data;
} __attribute__((packed));
typedef struct _packet_t packet_t;

// packet functions
uint16_t packetChecksum(packet_t *packet, int len);
uint16_t dataChecksum( char* data, int len );
packet_t *packetCreate(uint8_t *data, uint16_t len);
packet_t *packetAddHeader(int headersize, packet_t *p);
packet_t *packetCopy(packet_t *oldPacket);
void packetQueueAdd(packet_t *p);
packet_t *packetQueue(void);

#endif // PACKET_H
